<?php

// Copyright (c) 2012 Mirza Adipradhana

/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
/*                                      D E S K R I P S I                                           */
/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
/*
 * Menampilkan daftar rencana pembelajaran tiap tahun ajaran.
 * 
 * KETENTUAN:
 * ==========
 * (1) Semester 1 & 2 adalah mengacu pada MABA, sehingga jumlah kelas ditentukan oleh Inisialisasi MABA pada tahun ajaran yang bersangkutan
 *
 */
/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */


/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
/*               D E K L A R A S I / I N I S I A L I S A S I    V A R I A B E L                     */
/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
////
// STANDAR BAKU
$mApplication = new Application();
$mValidation = new InputValidation();

$_ERRHANDLER = false; //Error Handler, output: Array (ERROR_SECTION, ERROR_CODE)
$_ACTIONSTATE = true; //Action State: dimana jika bernilai true maka semua action aktif, jika false maka semua tidak aktif (hidden)
$_OUTPUTSTATE = true; //Output State: dimana jika bernilai true maka tampilkan output, jika false maka jangan tampilkan output
$_REFVALUE = false; // Nilai referensi yang WAJIB ada, jika tidak maka output false

$REFURL = $mApplication->GetRefererUrl();
$CURURL = $mApplication->GetCurrentUrl();

$BACKID = array();
////
////
// TAMBAHAN
////

/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */



/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
/*                              N I L A I   R E F E R E N C E                                       */
/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
// Tidak memerlukan nilai reference.

$_REFVALUE = true;

/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */



/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
/*                          I N I S I A L I S A S I   D A T A                                        */
/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
// Data / Nilai pendukung
// Proses ini dilakukan JIKA REFERENCE VALUE VALID
if ($_REFVALUE !== false) {
    $mDonatur = new AmalDonatur();
}

/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */


/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
/*                           K E T E N T U A N   O U T P U T                                        */
/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
if ($_REFVALUE) {
    //JIKA ADA KETENTUAN TAMBAHAN
} else {
    $_OUTPUTSTATE = false;
    $_ERRHANDLER[ERROR_SECTION] = "APPLICATION";
    $_ERRHANDLER[ERROR_CODE] = "REFERENCE_VALUE_NOT_VALID";
}


/* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
if ($_OUTPUTSTATE) {


    /*        ///       ///    ////////  ///////////         */
    /*        ///       ///   //             ///             */
    /*        ///       ///    ///////       ///             */
    /*        ///       ///          //      ///             */
    /*        ///////   ///   ////////       ///             */

    /* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
    /*                    I N I S I L A I S A S I   O U T P U T : L I S T                               */
    /* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
    $tDataList = $mDonatur->GenerateListDonatur();
    $tDataList->SetViewAll(true);
// STANDAR BAKU:

    $mOutputList = new ListTemplateJSON($tDataList);
    $mOutputList->SetFieldAction($_ACTIONSTATE);
////
////
// VALUE SUPPORT/REFERENCE 
// STANDAR BAKU:
    array_push($BACKID, "");
    $mOutputList->SetFieldSupport("fBackId", (count($BACKID) > 1 ? implode("|", $BACKID) : $BACKID[0]));
// TAMBAHAN:
    $mOutputList->SetFieldSupport($NAMA_VARIABEL, $VALUE);


////
// VALIDITAS DATA
////
    /* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */


    /* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
    /*                         S E T U P   O U T P U T : L I S T                                        */
    /* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */

    $mOutputList->SetTitle("DAFTAR DONATUR");

    $mOutputList->SetSearchableList(true);

    $mOutputList->SetFieldAction($_ACTIONSTATE);

    


////
// ACTION BUTTON
// ADD:
    $mOutputList->SetAddActionAuth(true);

// EDIT
    $mOutputList->SetEditActionAuth(false);

// DELETE
    $mOutputList->SetDeleteActionAuth(false);

// DETAIL
    $mOutputList->SetDetailActionAuth(true);
    $mOutputList->SetDetailActionTarget("main.php?menu=21&submenu=222");
////

    $tJSON= $mOutputList->PrintJSON();
    /* =========== *//* =========== *//* =========== *//* =========== *//* =========== *//* =========== */
}
?>
